package com.funo.wcity.app.dao;

import java.sql.SQLException;
import java.util.List;

import org.hibernate.HibernateException;
import org.hibernate.Query;
import org.hibernate.Session;
import org.springframework.orm.hibernate3.HibernateCallback;
import org.springframework.stereotype.Repository;

import com.funo.wcity.app.entity.TblUserMail;

@Repository("tblUserMailDAO")
public class TblUserMailDAO extends DefaultBaseDao<TblUserMail,Integer>{

	public List getTblUserMailList(final Integer idUser) {
		return this.hibernateTemplate.executeFind(new HibernateCallback(){
			public List doInHibernate(Session session) throws HibernateException,SQLException {
				String hql = "From TblUserMail t where t.idUser=:idUser order by lastDate";
				Query query=session.createQuery(hql);
				query.setInteger("idUser", idUser);
				return query.list();
			}
		});
	}

}
